import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { svgSpritemap } from 'vite-plugin-svg-spritemap';

const target = 'https://yunfeng.icu';
// const target = 'http://127.0.0.1:9098';

export default defineConfig({
  resolve: {
    alias: {
      '@': '/src'
    }
  },
  plugins: [
    vue(),
    svgSpritemap({
      pattern: 'src/assets/icons/*.svg',
      prefix: 'icon',
      currentColor: true
    }),
  ],
  build: {
    outDir: '../dist/html/home'
  },
  server: {
    port: 3000,
    open: true,
    proxy: {
      '/api': {
        target,
        changeOrigin: true, 
        // rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },
})
